<?php
namespace Hive\Ressource\Source\Parser;
/**
 * Source Parder Object.
 *
 * It will be used to parse the copy/paste URL and extratc the user id in 
 * the target source.
 *
 * @author Xavier VILAIN
 * @package Hive\Ressource\Source\Parser
 * @license #hive-license-social#
 *
 * @property string	$type			Id of the Source
 * @property string	$label			Source name
 * @property bool	$standard		Is a standard type (can't be deleted)
 * @property bool	$active			Is an active type (can be selected)
 */
class Viadeo {
	/**
	 * 
	 * Extract User Id
	 * @param string $url
	 * @return string
	 */
	public static function parse($url) {
		
		if(preg_match_all("/http:\/\/www.viadeo.com\/profile\/(.*?)(\/|\?)+/", $url,$matches)) {
			return $matches[1][0];
		} elseif(preg_match_all("/http:\/\/www.viadeo.com\/profile\/(.*)/", $url,$matches)) {
			return $matches[1][0];
		} else {
			var_dump($url);
		}
	}
}